<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>创建对象</title>
	</head>
	<body>
		<script>
			var arr=[3,56,7];
			var arr2=new Array('apple','banana');
			//创建对象的2种方式
			//1、字面量，"名/值" 对，用逗号分隔
			var person={
				name:'zjy',
				age: 28,
				sayHi:function(){
					console.log("Hello js")
				}
				};
			//属性和方法的调用
			
	console.log(person.name)
	console.log(person['age'])		 
			person.sayHi();
			//2、new 创建对象
			var cat=new Object();
			cat.color='balck';
			cat.name='kitty';
			cat.fun=function(){
				console.log("吃鱼")
			};
			console.log(cat.name);
			console.log(cat['color']);
			cat.fun();
			
			
		</script>
	</body>
</html>
